//
//  LoginViewController.m
//  Hxg_StudyProject
//
//  Created by 黄小刚 on 2018/8/17.
//  Copyright © 2018年 XMYY-19. All rights reserved.
//

#import "LoginViewController.h"
#import "Masonry.h"
#import "ReactiveObjC.h"
#import "ReginsterVC.h"
#import "ForgetPswVC.h"

@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIButton *btn = [[UIButton alloc] init];
    [self.view addSubview:btn];
    [btn setTitle:@"登陆" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [btn setBackgroundColor:[UIColor lightGrayColor]];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view.mas_centerX);
        make.centerY.equalTo(self.view.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(200.0f, 100.0f));
    }];
    
    [[btn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        
        NSLog(@"执行登陆...");
        
    }];
    
    // 注册按钮
    UIButton *registerBtn = [[UIButton alloc] init];
    [self.view addSubview:registerBtn];
    [registerBtn setTitle:@"注册" forState:UIControlStateNormal];
    [registerBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [registerBtn setBackgroundColor:[UIColor lightGrayColor]];
    [registerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(btn.mas_leading);
        make.top.equalTo(btn.mas_bottom).offset(20.0f);
        make.size.mas_equalTo(CGSizeMake(80.0f, 100.0f));
    }];
    
    [[registerBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        NSLog(@"注册...");
        ReginsterVC *regVC = [[ReginsterVC alloc] init];
        [self presentViewController:regVC animated:YES completion:nil];
    }];
    
    
    // 忘记密码
    UIButton *forgetBtn = [[UIButton alloc] init];
    [self.view addSubview:forgetBtn];
    [forgetBtn setTitle:@"忘记密码" forState:UIControlStateNormal];
    [forgetBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [forgetBtn setBackgroundColor:[UIColor lightGrayColor]];
    [forgetBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(btn.mas_trailing);
        make.top.equalTo(registerBtn.mas_top);
        make.size.mas_equalTo(CGSizeMake(80.0f, 100.0f));
    }];
    
    [[forgetBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        NSLog(@"忘记密码...");

        ForgetPswVC *forgetPsw = [[ForgetPswVC alloc] init];
        [self presentViewController:forgetPsw animated:YES completion:nil];
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
